<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.js"></script>
    <script src="./js/测试单词.js"></script>
    <script>
        var ptt = /[a-zA-Z-]+/ig;
        cat = cat.match(ptt);
        var mask = [];
        [].forEach.call(cat, function (value) {
            if (mask.indexOf(value) == -1 && value.length >= 2) {
                mask.push(value);
            }
        });
        // console.log(mask);
        All = [];
        [].forEach.call(mask, function (item) {
            var cat = item.split("-");
            if (cat[1]) {
                cat = cat[0] + cat[1][0].toUpperCase() + cat[1].slice(1,);
            }
            All.push(cat);
        });
        console.log(All);
        var blackCat = "";
        [].forEach.call(All, function (item) {
            blackCat +=
                `"call to .${item}": {
                "prefix": ".${item}",
                "body": [
                    ".${item}",
                ],
                "description": "call to .${item}"
            },\r\n`;
            blackCat +=
                `"call to ${item}": {
                "prefix": "${item}",
                "body": [
                    "${item}",
                ],
                "description": "call to ${item}"
            },\r\n`;
        });
        jQuery("<pre></pre>").html(blackCat).appendTo("body");
    </script>
</body>

</html>